package com.wwtech.epp.ui.adapter.work;

import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wwtech.epp.R;
import com.wwtech.epp.entity.Approve;
import com.wwtech.epp.utils.WorkUtil;
import com.wwtech.epp.view.GlideCircleTransform;

import java.util.List;







/**
 * @author hzp
 * @Package com.wwtech.epp.ui.activity.work
 * @Description: $description  adapter of ApproveListFragment
 * @date 2017/09/16 23:03:27
 */

public class ApproveListAdapter extends BaseQuickAdapter<Approve.DataBean.ListBean, BaseViewHolder> {

    public ApproveListAdapter(@Nullable List<Approve.DataBean.ListBean> data) {
       super(R.layout.item_approve_list, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, Approve.DataBean.ListBean item) {
        baseViewHolder.setText(R.id.title, item.getNickName() + "的" + WorkUtil.idParse2Type(item.getAppId()));
        baseViewHolder.setText(R.id.time, "时间:" + item.getRequestTime());
        TextView textView = baseViewHolder.getView(R.id.state);
        WorkUtil.approveStateParse(mContext, item.getState(), textView);
        ImageView iv_avatar = baseViewHolder.getView(R.id.iv_avatar);
        Glide.with(mContext)
                .load(item.getAvatar())
                .transform(new GlideCircleTransform(mContext))
                .into(iv_avatar);
    }
}